<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册会员</title>
    <link rel="shortcut icon" href="favicon.ico"> <link href="__PUBLIC__/Theme1/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/static/plupload/upfiless.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/Theme1/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/Theme1/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>添加会员信息 <a href="__URL__/lists" style="margin-left:15px; color:#06cbc4">会员列表</a></h5>
                        <div class="ibox-tools">

                        </div>
                    </div>
                    <div class="ibox-content">
                        <form method="post" action="__URL__/AddAction" class="form-horizontal" id="form-admin-add" enctype="multipart/form-data">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">会员编号</label>
                                <div class="col-sm-3">

									<input type="text" class="form-control" name="txt_loginname1" id="txt_loginname1" onBlur="fmCheckUserName('txt_loginname_msg',this.value,'恭喜,可以使用','对不起,该编号已经使用')" style="width:65%;" value="<{$bianhao}>" readonly />

									<input type="hidden" value="<{$bianhao}>" name="txt_loginname" id="txt_loginname"  />
                                </div>
                            </div>

                            <div class="form-group">
                                 <label class="col-sm-1 control-label">姓名</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_bankname" id="txt_bankname" class="form-control">
                                </div>

                            </div>


                            <div class="form-group">
                                <label class="col-sm-1 control-label">手机号码</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_tel" id="txt_tel" class="form-control" onBlur="shoujihaoma(this.value)" />
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">推荐人</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_rid" id="txt_rid" class="form-control" onBlur="is_tuijian(this.value)"value = "<{$_SESSION['nvip_nvip_member_User']}>" >
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">接点人</label>
                                <div class="col-sm-3">

                                <if condition="$_GET['pid']  neq null">

                                    <input type="text" name="txt_pid" id="txt_pid" class="form-control" value="<{$_GET['pid']}>" readonly>

                                <else/>
                                    <input type="text" name="txt_pid" id="txt_pid" class="form-control" onBlur="is_jiedian(this.value)"value = "<{$_SESSION['nvip_nvip_member_User']}>" readonly>
                                    </if>
                                </div>

                            </div>
                            <div class="form-group">

                                <label class="col-sm-1 control-label">接点区域</label>
                                <div class="col-sm-3">
                                <if condition="$_GET['area'] neq null" >

                                    <if condition="$_GET['area'] neq null  &&  $_GET['area'] eq 1">
                                        <input name="txt_area" id="txt_areaaqu" type="radio" value="<{$_GET['area']}>" checked>一部
                                    </if>

                                    <if condition="$_GET['area'] neq null  &&  $_GET['area'] eq 2">
                                        <input name="txt_area" id="txt_areabqu" type="radio" value="<{$_GET['area']}>" checked>二部

                                    </if>

                                <else/>
                                    <input name="txt_area" id="txt_areaaqu" type="radio" value="1"  onBlur="is_aqu(this.value)">一部
                                    <input name="txt_area" id="txt_areabqu" type="radio" value="2"  onBlur="is_bqu(this.value)">二部
                                </if>
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">登陆密码</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_pwd1" id="txt_pwd1" class="form-control">
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">二级密码</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_pwd2" id="txt_pwd2" class="form-control">
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">会员级别</label>
                                <div class="col-sm-3">
                                    <input name="txt_jibie" id="txt_jibie" type="radio" value="0"  >普通会员
                                    <!-- <input name="txt_jibie" id="txt_jibie" type="text"  value="会员费用为:0"  style="width:90px" disabled/> -->
                                    <input name="txt_jibie" id="txt_jibie" type="radio" value="1"  >铜卡会员
                                    <input name="txt_jibie" id="txt_jibie" type="radio" value="2"  >银卡会员
                                    <input name="txt_jibie" id="txt_jibie" type="radio" value="3"  >金卡会员
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">淘宝账号</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_taobao" id="txt_taobao" class="form-control" onBlur="is_taobao(this.value)" />
                                </div>

                            </div>

                            <div class="form-group">
                                <label class="col-sm-1 control-label">支付宝号</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_zhifubao" id="txt_zhifubao" class="form-control" onBlur="is_zhifubao(this.value)" />
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">支付宝姓名</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_zfbname" id="txt_zfbname" class="form-control" onBlur="is_zfbname(this.value)" />
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">开户银行</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_bank" id="txt_bank" class="form-control" onBlur="is_bank(this.value)" />
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">银行卡号</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_bankno" id="txt_bankno" class="form-control"  onBlur="is_bankno(this.value)" />
                                </div>

                            </div>

                            <div class="form-group">
                                <label class="col-sm-1 control-label">开户姓名</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_truename" id="txt_truename" class="form-control"  onBlur="is_truename(this.value)" />
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">开户地址</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_bankaddress" id="txt_bankaddress" class="form-control" onBlur="is_bankaddress(this.value)" />
                                </div>

                            </div>

                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" type="submit">添加会员</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="__PUBLIC__/Theme1/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/Theme1/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__PUBLIC__/Theme1/js/content.min.js?v=1.0.0"></script>
    <script src="__PUBLIC__/Theme1/js/plugins/iCheck/icheck.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/Theme1/check/js/jquery.validate.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/Theme1/check/js/messages_zh.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/Theme1/check/js/validate-methods.js"></script>
<script type="text/javascript" src="__PUBLIC__/Theme1/lib/webuploader/0.1.5/webuploader.min.js"></script>

    <script>
        $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
    </script>

    <script type="text/javascript">

	function shoujihaoma(thisvalue){

			var reg = /^\d{9,}$/;

			$("#txt_tel-error").remove();
		 if(!reg.test(thisvalue)){
			$("#txt_tel").addClass("error");
			$("#txt_tel").after('<label id="txt_tel-error" class="error" for="txt_tel" style="display: inline-block;">格式不正确</label>');

			return false;
		 }
		 else{
			$("#txt_tel").removeClass("error");
			return true;
		 }


	}

    function is_taobao(thisvalue){

         if(txt_taobao.value==""){
            $("#txt_taobao").addClass("error");
            $("#txt_taobao").after('<label id="txt_taobao-error" class="error" for="txt_taobao" style="display: inline-block;">请填写淘宝账号</label>');

            return false;
         }
         else{
            $("#txt_taobao").removeClass("error");
            return true;
         }


    }

    function is_zhifubao(thisvalue){

         if(txt_zhifubao.value==""){
            $("#txt_zhifubao").addClass("error");
            $("#txt_zhifubao").after('<label id="txt_zhifubao-error" class="error" for="txt_zhifubao" style="display: inline-block;">请填写支付宝账号</label>');

            return false;
         }
         else{
            $("#txt_zhifubao").removeClass("error");
            return true;
         }


    }

    function is_zfbname(thisvalue){

         if(txt_zfbname.value==""){
            $("#txt_zfbname").addClass("error");
            $("#txt_zfbname").after('<label id="txt_zfbname-error" class="error" for="txt_zfbname" style="display: inline-block;">请填写支付宝姓名</label>');

            return false;
         }
         else{
            $("#txt_zfbname").removeClass("error");
            return true;
         }


    }

    function is_bank(thisvalue){

         if(txt_bank.value==""){
            $("#txt_bank").addClass("error");
            $("#txt_bank").after('<label id="txt_bank-error" class="error" for="txt_bank" style="display: inline-block;">请填写开户行</label>');

            return false;
         }
         else{
            $("#txt_bank").removeClass("error");
            return true;
         }


    }
    function is_bankno(thisvalue){

        if(txt_bankno.value==""){
         $("#txt_bankno").addClass("error");
            $("#txt_bankno").after('<label id="txt_bankno-error" class="error" for="txt_bankno" style="display: inline-block;">请填写银行卡号</label>');

            return false;
         }
         else{
            $("#txt_bankno").removeClass("error");
            return true;
         }


    }

    function is_truename(thisvalue){

         if(txt_truename.value==""){
            $("#txt_truename").addClass("error");
            $("#txt_truename").after('<label id="txt_truename-error" class="error" for="txt_truename" style="display: inline-block;">请填写银行卡开户姓名</label>');

            return false;
         }
         else{
            $("#txt_truename").removeClass("error");
            return true;
         }


    }

    function is_bankaddress(thisvalue){

         if(txt_bankaddress.value==""){
            $("#txt_bankaddress").addClass("error");
            $("#txt_bankaddress").after('<label id="txt_bankaddress-error" class="error" for="txt_bankaddress" style="display: inline-block;">请填写银行卡开户地址</label>');

            return false;
         }
         else{
            $("#txt_bankaddress").removeClass("error");
            return true;
         }


    }


	function is_tuijian(thisvalue)
	{
		if(thisvalue.length>0){
			$("#is_tuijian-error").remove();
		htmlobj=$.ajax({url:"__URL__/CheckTuijian?username=" + escape(thisvalue),async:false});

		if (escape(htmlobj.responseText)=="0"){

			$("#txt_rid").addClass("error");
			$("#txt_rid").after('<label id="is_tuijian-error" class="error" for="txt_rid" style="display: inline-block;">推荐人不存在</label>');

			return false;
		}
		if (escape(htmlobj.responseText)=="1"){
			$("#txt_rid").removeClass("error");
			return true;
		}
	 }


	}

    //判断接点人

    function is_jiedian(thisvalue)
    {
        if(thisvalue.length>0){
            $("#is_jiedian-error").remove();
        htmlobj=$.ajax({url:"__URL__/CheckJieDian?username=" + escape(thisvalue),async:false});

        if (escape(htmlobj.responseText)=="0"){

            $("#txt_pid").addClass("error");
            $("#txt_pid").after('<label id="is_jiedian-error" class="error" for="txt_pid" style="display: inline-block;">接点人不存在</label>');

            return false;
        }
        if (escape(htmlobj.responseText)=="1"){
            $("#txt_pid").removeClass("error");
            return true;
        }
     }

    }



    //安放区域
    function is_aqu(thisvalue)
    {
        var jiedian= $("#txt_pid").val();
        if(thisvalue.length>0){
            $("#is_aqu-error").remove();
        htmlobj=$.ajax({url:"__URL__/CheckAqu?username=" + escape(jiedian),async:false});
        if (escape(htmlobj.responseText)=="0"){
            // alert('xxx11');
            $("#txt_areaaqu").addClass("error");
            $("#txt_areaaqu").after('<label id="txt_areaaqu-error" class="error" for="txt_area" style="display: inline-block;">一部已存在</label>');

            return false;
        }
        if (escape(htmlobj.responseText)=="1"){
            // alert('xxx22');
            $("#txt_areaaqu").removeClass("error");
            return true;
        }
     }

	}

    function is_bqu(thisvalue)
    {
        var jiedian= $("#txt_pid").val();
        if(thisvalue.length>0){
            $("#is_bqu-error").remove();
        htmlobj=$.ajax({url:"__URL__/CheckBqu?username=" + escape(jiedian),async:false});

        if (escape(htmlobj.responseText)=="0"){

            $("#txt_areabqu").addClass("error");
            $("#txt_areabqu").after('<label id="txt_areabqu-error" class="error" for="txt_area" style="display: inline-block;">二部已存在</label>');

            return false;
        }
        if (escape(htmlobj.responseText)=="1"){
            $("#txt_areabqu").removeClass("error");
            return true;
        }
     }

    }



	$(function(){

	$("#form-admin-add").validate({
		rules:{
            txt_loginname1:{
                required:true,
                minlength:1,
                maxlength:8
            },
            txt_bankname:{
                required:true,
                minlength:1,
                maxlength:16
            },

            txt_rid:{
                required:true,
                minlength:1,
                maxlength:16
            },
            txt_pid:{
                required:true,
                minlength:1,
                maxlength:16
            },
            txt_area:{
                required:true,
                minlength:1,
                maxlength:5
            },

            txt_tel:{
                required:true,
                minlength:7,
                maxlength:11
            },
            txt_pwd1:{
                required:true,
                minlength:6,
                maxlength:20
            },
            txt_pwd2:{
                required:true,
                minlength:6,
                maxlength:20
            },
            txt_taobao:{
                required:true,
                minlength:2,
                maxlength:30
            },
            txt_zhifubao:{
                required:true,
                minlength:2,
                maxlength:30
            },
            txt_zfbname:{
                required:true,
                minlength:2,
                maxlength:8
            },
            txt_bank:{
                required:true,
                minlength:2,
                maxlength:20
            },
            txt_bankno:{
                required:true,
                minlength:10,
                maxlength:35
            },
            txt_truename:{
                required:true,
                minlength:2,
                maxlength:8
            },
            txt_bankaddress:{
                required:true,
                minlength:2,
                maxlength:30
            }


        },

		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){

			if(is_tuijian($("#txt_rid").val()) && shoujihaoma($("#txt_tel").val())){

				$(form).ajaxSubmit();
				var index = parent.layer.getFrameIndex(window.name);
				parent.$('.btn-refresh').click();
				parent.layer.close(index);
			}

            if(is_tuijian($("#txt_pid").val())){

                $(form).ajaxSubmit();
                var index = parent.layer.getFrameIndex(window.name);
                parent.$('.btn-refresh').click();
                parent.layer.close(index);
            }


		}
	});
});
</script>

</body>

</html>
